<template>
  <div class="aboutAllMajor">
    <ul class="majorList">
      <li class="majorItem" v-for="(item, index) of majorList" :key="index" @click="jumpInToCatalogList(item)">
        <div class="majorMsg">{{ item }}</div>
        <div class="imgIcon">
          <i></i>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import { getmajorlistbyname } from '~/api/repository'
import ls from 'store2';
export default {
  name: 'AboutAllMajor',
  props: {
    jobDetail: Object
  },
  data() {
    return {
      majorList: []
    }
  },
  mounted() {
    this.majorList = this.jobDetail.major ? this.jobDetail.major.split('、') : []
  },
  methods: {
    // 跳到专业类界面
    jumpInToCatalogList(name) {
      const that = this
      getmajorlistbyname({ catalog_name: name }).then(res => {
        ls.set('preUrl', '/professional/jobDetail')
        ls.set('jobDetailType', this.$route.query.type)
        ls.set("catalogMsg", res.data[0]);
        if (that.commonJs.GetUrlParam('mini_token')) {
          this.$router.push({
            path: '/professional/majorList',
            query: {
              type: name,
              mini_token: this.commonJs.GetUrlParam('mini_token')
            }
          })
        } else {
          this.$router.push({ path: "/professional/majorList?type="+name });
        }
      })
    },
    goto(routerName, queryData) {
      this.$store.commit('changeSendMsg', queryData)
      this.$router.push({
        path: routerName,
      });
    },
  }
}
</script>

<style lang="less" scoped>
  .aboutAllMajor {
    .majorList {
      list-style: none;
      padding-left: 0;
      .majorItem {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 1.12rem;
        width: 100%;
        border-bottom: 1px solid #E5E8ED;
        .majorMsg {
          color: #222;
          font-size: 0.3rem;
        }
        .imgIcon {
          width: 0.4rem;
          height: 0.4rem;
          i {
            width: 100%;
            height: 100%;
            display: inline-block;
            background: url('~@/static/sprite/icon_sprites_40.png') -1.3rem -0.7rem;
            background-size:3rem 2.4rem;
          }
        }
      }
    }
  }
</style>
